﻿<%@ WebHandler Language="C#" Class="AjaxGetWaitWorkCnt" %>

using System;
using System.Dynamic;
using System.Web;
using System.Web.SessionState;
using Business.Common;
using Business.FlowOperation;

public class AjaxGetWaitWorkCnt : IHttpHandler, IRequiresSessionState
{
    public void ProcessRequest(HttpContext context)
    {
        var userId = Convert.ToString(context.Session["UserId"]);
        context.Response.ContentType = "text/plain";
        context.Response.Write(GetCount(userId));
    }

    private static string GetCount(string userId)
    {
        dynamic dyn = new ExpandoObject();
        dyn.WaitWorkCount = RequestFlowOperation.Instance.GetWaitWorkCount(userId);
        return ComFunc.T2Json(dyn);
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}